<?php $this -> load -> view('adminx/header'); ?>
<!-- BEGIN CONTAINER -->
<div class="page-container">
	<!-- BEGIN SIDEBAR -->
	<?php $this -> load -> view('adminx/mune'); ?>
	<!-- END SIDEBAR -->
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<!-- /.modal -->
			<h3 class="page-title"> <?php echo $title; ?> <small><?php echo $en; ?></small></h3>
			<div class="page-bar">
				<ul class="page-breadcrumb">
					<li>
						<i class="fa fa-home"></i>
						<a href="/adminx">首页</a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="/iadmin/sp"><?php echo $title; ?></a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="#">添加商品</a>
					</li>
				</ul>
			</div>
			<!-- END PAGE HEADER-->
			<div class="clearfix"></div>
			
			
			
			
			<div class="row">
				<div class="col-md-12">
					<div class="note note-success">
						<p>1，选择了供货机构，选择启动通过红包发送供货款，同时填写了供货价格，满足这3个设置，在会员确定收货时，供货款项会通过红包发送出去；</p>
						<p>2，代理积分即红包的金额，设置为0，就禁止了这个级别的大掌柜收到红包；</p>
						<p>3，库存为0，或销售价格为0，或者商品下架时，这个商品加入不了购物车；</p>
						<p>4，供货发送为：到店消费，购物车会显示该供货机构的地址、联系方式等信息；</p>
						<p>5，当礼券金额不为0，会员实际需要支付的金额为：供货价格减去礼券金额，购物车会显示礼券金额的信息；</p>
					</div>
					
					
					
					<form class="form-horizontal form-row-seperated" action="#">
						<div class="portlet light">
							
						<div class="portlet-title">
							<div class="caption">
								<i class="icon-share font-red-sunglo"></i>
								<span class="caption-subject font-red-sunglo bold uppercase"> 添加商品</span>
							</div>
							<div class="actions btn-set">
									<a class="btn btn-circle btn-icon-only blue" href="javascript:;" onclick="alert_ts('<?php echo $this -> config -> item('xt_ts'); ?>')"> <i class=" icon-bulb"></i> </a>
								    <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;"> </a>
								</div>
						</div>
							<div class="portlet-body">
								<div class="actions btn-set pull-right">
									<button type="button" name="back" class="btn default"><i class="fa fa-angle-left"></i> 返回</button>
									<button type="reset" class="btn default"><i class="fa fa-reply"></i> 重置</button>
									<button class="btn green"><i class="fa fa-check"></i> 保存</button>
								</div>
								<div class="tabbable">
									<ul class="nav nav-tabs">
										<li class="active">
											<a href="#tab_base" data-toggle="tab" aria-expanded="true">
											基本信息 </a>
										</li>
										<li class="">
											<a href="#tab_pic" data-toggle="tab" aria-expanded="false">
											图片 </a>
										</li>
										<li class="">
											<a href="#tab_kc" data-toggle="tab" aria-expanded="false">
											库存 </a>
										</li>
										<li class="">
											<a href="#tab_hb" data-toggle="tab" aria-expanded="false">
											红包 
											</a>
										</li>
										<li class="">
											<a href="#tab_setting" data-toggle="tab" aria-expanded="false">
											设置 </a>
										</li>
										<li class="">
											<a href="#tab_mx" data-toggle="tab" aria-expanded="false">
											明细 </a>
										</li>
									</ul>
									<div class="tab-content no-space">
										<div class="tab-pane active" id="tab_base">
												 <div class="form-group">
												 	<label class="col-md-2 control-label">分类
													</label>
													<div class="col-md-10">
								                       <?php echo $this -> form -> doform('classd', 'fl1', '', '','3'); ?>
								                       </div>
							                      </div>
												<div class="form-group">
													<label class="col-md-2 control-label">名称: <span class="required">
													* </span>
													</label>
													<div class="col-md-10">
														<input class="form-control required" name="name" placeholder="名称"/>
													</div>
												</div>
												<div class="form-group">
													<label class="col-md-2 control-label">标签: <span class="required">
													* </span>
													</label>
													<div class="col-md-10">
														<input class="form-control" name="bq" placeholder="多个标签用&分开，比如：&蔬菜&海鲜&牛肉&"/>
													    <span class="help-block"> 多个标签用&分开，比如：&蔬菜&海鲜&牛肉& </span>
													</div>
												</div>
												<div class="form-group">
													<label class="col-md-2 control-label">编号: <span class="required">
													* </span>
													</label>
													<div class="col-md-10">
														<input class="form-control required" name="bh" placeholder="编号"/>
													</div>
												</div>
												
												
												<div class="form-group">
													<label class="col-md-2 control-label">推荐语: 
													</label>
													<div class="col-md-10">
														<input class="form-control" name="tj" placeholder="推荐语"/>
													</div>
												</div>
												<div class="form-group">
													<label class="col-md-2 control-label">排序: <span class="required">
													* </span>
													</label>
													<div class="col-md-10">
														<input class="form-control number required" name="sort" placeholder="越小越靠前"/>
													</div>
												</div>
												<div class="form-group">
													<label class="col-md-2 control-label">市场价格: <span class="required">
													* </span>
													</label>
													<div class="col-md-10">
														<input class="form-control number required" name="price_sc" placeholder="只填写数字"/>
													</div>
												</div>
												<div class="form-group">
													<label class="col-md-2 control-label">销售价格: <span class="required">
													* </span>
													</label>
													<div class="col-md-10">
														<input class="form-control number required" name="price" placeholder="只填写数字"/>
													</div>
												</div>
												<div class="form-group">
													<label class="col-md-2 control-label">供货价格: 
													</label>
													<div class="col-md-10">
														<input class="form-control" name="sk_je" placeholder="供货商价格"/>
													</div>
												</div>
											</div>
											
										<div class="tab-pane" id="tab_pic">
											<div class="row">
												<div class="col-md-3">
													<p>第一张封面图</p>
													<?php echo $this -> form -> doform('pic', 'pic1', '', ''); ?>
												</div>
												<div class="col-md-3">
													<p>第二张封面图</p>
													<?php echo $this -> form -> doform('pic', 'pic2', '', ''); ?>
												</div>
												<div class="col-md-3">
													<p>第三张封面图</p>
													<?php echo $this -> form -> doform('pic', 'pic3', '', ''); ?>
												</div>
												<div class="col-md-3">
													<p>购买按钮</p>
													<?php echo $this -> form -> doform('pic', 'gm_bt', '', ''); ?>
												</div>
											</div>
										</div>
										<div class="tab-pane" id="tab_kc">
											<div class="alert alert-success margin-bottom-10">
												<button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button>
												<i class="fa fa-warning fa-lg"></i> Image type and information need to be specified.
											</div>
											<div id="tab_kc_uploader_container" class="text-align-reverse margin-bottom-10" style="position: relative;">
												<a id="tab_kc_uploader_pickfiles" href="javascript:;" class="btn yellow" style="z-index: 1;">
												<i class="fa fa-plus"></i> Select Files </a>
												<a id="tab_kc_uploader_uploadfiles" href="javascript:;" class="btn green">
												<i class="fa fa-share"></i> Upload Files </a>
											<div id="html5_19oak5gh614ujuli1ksl1ie7ltm3_container" class="moxie-shim moxie-shim-html5" style="position: absolute; top: 0px; left: 0px; width: 0px; height: 0px; overflow: hidden; z-index: 0;"><input id="html5_19oak5gh614ujuli1ksl1ie7ltm3" type="file" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" multiple="" accept="image/jpeg,image/gif,image/png,application/zip"></div></div>
											<div class="row">
												<div id="tab_kc_uploader_filelist" class="col-md-6 col-sm-12"></div>
											</div>
											<table class="table table-bordered table-hover">
											<thead>
											<tr role="row" class="heading">
												<th width="8%">
													 Image
												</th>
												<th width="25%">
													 Label
												</th>
												<th width="8%">
													 Sort Order
												</th>
												<th width="10%">
													 Base Image
												</th>
												<th width="10%">
													 Small Image
												</th>
												<th width="10%">
													 Thumbnail
												</th>
												<th width="10%">
												</th>
											</tr>
											</thead>
											<tbody>
											<tr>
												<td>
													<a href="../../assets/admin/pages/media/works/img1.jpg" class="fancybox-button" data-rel="fancybox-button">
													<img class="img-responsive" src="../../assets/admin/pages/media/works/img1.jpg" alt="">
													</a>
												</td>
												<td>
													<input type="text" class="form-control" name="product[images][1][label]" value="Thumbnail image">
												</td>
												<td>
													<input type="text" class="form-control" name="product[images][1][sort_order]" value="1">
												</td>
												<td>
													<label>
													<div class="radio"><span><input type="radio" name="product[images][1][image_type]" value="1"></span></div>
													</label>
												</td>
												<td>
													<label>
													<div class="radio"><span><input type="radio" name="product[images][1][image_type]" value="2"></span></div>
													</label>
												</td>
												<td>
													<label>
													<div class="radio"><span class="checked"><input type="radio" name="product[images][1][image_type]" value="3" checked=""></span></div>
													</label>
												</td>
												<td>
													<a href="javascript:;" class="btn default btn-sm">
													<i class="fa fa-times"></i> Remove </a>
												</td>
											</tr>
											<tr>
												<td>
													<a href="../../assets/admin/pages/media/works/img2.jpg" class="fancybox-button" data-rel="fancybox-button">
													<img class="img-responsive" src="../../assets/admin/pages/media/works/img2.jpg" alt="">
													</a>
												</td>
												<td>
													<input type="text" class="form-control" name="product[images][2][label]" value="Product image #1">
												</td>
												<td>
													<input type="text" class="form-control" name="product[images][2][sort_order]" value="1">
												</td>
												<td>
													<label>
													<div class="radio"><span><input type="radio" name="product[images][2][image_type]" value="1"></span></div>
													</label>
												</td>
												<td>
													<label>
													<div class="radio"><span class="checked"><input type="radio" name="product[images][2][image_type]" value="2" checked=""></span></div>
													</label>
												</td>
												<td>
													<label>
													<div class="radio"><span><input type="radio" name="product[images][2][image_type]" value="3"></span></div>
													</label>
												</td>
												<td>
													<a href="javascript:;" class="btn default btn-sm">
													<i class="fa fa-times"></i> Remove </a>
												</td>
											</tr>
											<tr>
												<td>
													<a href="../../assets/admin/pages/media/works/img3.jpg" class="fancybox-button" data-rel="fancybox-button">
													<img class="img-responsive" src="../../assets/admin/pages/media/works/img3.jpg" alt="">
													</a>
												</td>
												<td>
													<input type="text" class="form-control" name="product[images][3][label]" value="Product image #2">
												</td>
												<td>
													<input type="text" class="form-control" name="product[images][3][sort_order]" value="1">
												</td>
												<td>
													<label>
													<div class="radio"><span class="checked"><input type="radio" name="product[images][3][image_type]" value="1" checked=""></span></div>
													</label>
												</td>
												<td>
													<label>
													<div class="radio"><span><input type="radio" name="product[images][3][image_type]" value="2"></span></div>
													</label>
												</td>
												<td>
													<label>
													<div class="radio"><span><input type="radio" name="product[images][3][image_type]" value="3"></span></div>
													</label>
												</td>
												<td>
													<a href="javascript:;" class="btn default btn-sm">
													<i class="fa fa-times"></i> Remove </a>
												</td>
											</tr>
											</tbody>
											</table>
										</div>
										<div class="tab-pane" id="tab_hb">
											<div class="table-container">
												<div id="datatable_reviews_wrapper" class="dataTables_wrapper dataTables_extended_wrapper no-footer"><div class="row"><div class="col-md-8 col-sm-12"><div class="dataTables_paginate paging_bootstrap_extended" id="datatable_reviews_paginate"><div class="pagination-panel"> Page <a href="#" class="btn btn-sm default prev disabled" title="Prev"><i class="fa fa-angle-left"></i></a><input type="text" class="pagination-panel-input form-control input-mini input-inline input-sm" maxlenght="5" style="text-align:center; margin: 0 5px;"><a href="#" class="btn btn-sm default next disabled" title="Next"><i class="fa fa-angle-right"></i></a> of <span class="pagination-panel-total"></span></div></div><div class="dataTables_length" id="datatable_reviews_length"><label><span class="seperator">|</span>View <select name="datatable_reviews_length" aria-controls="datatable_reviews" class="form-control input-xsmall input-sm input-inline"><option value="10">10</option><option value="20">20</option><option value="50">50</option><option value="100">100</option><option value="150">150</option><option value="-1">All</option></select> records</label></div><div class="dataTables_info" id="datatable_reviews_info" role="status" aria-live="polite"></div></div><div class="col-md-4 col-sm-12"><div class="table-group-actions pull-right"></div></div></div><div class="table-scrollable"><table class="table table-striped table-bordered table-hover dataTable no-footer" id="datatable_reviews" aria-describedby="datatable_reviews_info" role="grid">
												<thead>
												<tr role="row" class="heading"><th width="5%" class="sorting" tabindex="0" aria-controls="datatable_reviews" rowspan="1" colspan="1">
														 Review&nbsp;#
													</th><th width="10%" class="sorting" tabindex="0" aria-controls="datatable_reviews" rowspan="1" colspan="1">
														 Review&nbsp;Date
													</th><th width="10%" class="sorting" tabindex="0" aria-controls="datatable_reviews" rowspan="1" colspan="1">
														 Customer
													</th><th width="20%" class="sorting" tabindex="0" aria-controls="datatable_reviews" rowspan="1" colspan="1">
														 Review&nbsp;Content
													</th><th width="10%" class="sorting" tabindex="0" aria-controls="datatable_reviews" rowspan="1" colspan="1">
														 Status
													</th><th width="10%" class="sorting" tabindex="0" aria-controls="datatable_reviews" rowspan="1" colspan="1">
														 Actions
													</th></tr>
												<tr role="row" class="filter"><td rowspan="1" colspan="1">
														<input type="text" class="form-control form-filter input-sm" name="product_review_no">
													</td><td rowspan="1" colspan="1">
														<div class="input-group date date-picker margin-bottom-5" data-date-format="dd/mm/yyyy">
															<input type="text" class="form-control form-filter input-sm" readonly="" name="product_review_date_from" placeholder="From">
															<span class="input-group-btn">
															<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
															</span>
														</div>
														<div class="input-group date date-picker" data-date-format="dd/mm/yyyy">
															<input type="text" class="form-control form-filter input-sm" readonly="" name="product_review_date_to" placeholder="To">
															<span class="input-group-btn">
															<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
															</span>
														</div>
													</td><td rowspan="1" colspan="1">
														<input type="text" class="form-control form-filter input-sm" name="product_review_customer">
													</td><td rowspan="1" colspan="1">
														<input type="text" class="form-control form-filter input-sm" name="product_review_content">
													</td><td rowspan="1" colspan="1">
														<select name="product_review_status" class="form-control form-filter input-sm">
															<option value="">Select...</option>
															<option value="pending">Pending</option>
															<option value="approved">Approved</option>
															<option value="rejected">Rejected</option>
														</select>
													</td><td rowspan="1" colspan="1">
														<div class="margin-bottom-5">
															<button class="btn btn-sm yellow filter-submit margin-bottom"><i class="fa fa-search"></i> Search</button>
														</div>
														<button class="btn btn-sm red filter-cancel"><i class="fa fa-times"></i> Reset</button>
													</td></tr>
												</thead>
												<tbody>
												</tbody>
												</table></div><div class="row"><div class="col-md-8 col-sm-12"><div class="dataTables_paginate paging_bootstrap_extended"><div class="pagination-panel"> Page <a href="#" class="btn btn-sm default prev disabled" title="Prev"><i class="fa fa-angle-left"></i></a><input type="text" class="pagination-panel-input form-control input-mini input-inline input-sm" maxlenght="5" style="text-align:center; margin: 0 5px;"><a href="#" class="btn btn-sm default next disabled" title="Next"><i class="fa fa-angle-right"></i></a> of <span class="pagination-panel-total"></span></div></div><div class="dataTables_length"><label><span class="seperator">|</span>View <select name="datatable_reviews_length" aria-controls="datatable_reviews" class="form-control input-xsmall input-sm input-inline"><option value="10">10</option><option value="20">20</option><option value="50">50</option><option value="100">100</option><option value="150">150</option><option value="-1">All</option></select> records</label></div><div class="dataTables_info"></div></div><div class="col-md-4 col-sm-12"></div></div></div>
											</div>
										</div>
										<div class="tab-pane" id="tab_setting">
											
										</div>
										<div class="tab-pane" id="tab_mx">
											
										</div>
									</div>
								</div>
							</div>
						</div>
					</form>
				</div>
			</div>
			
			
			
			
			
			
			
			
			
			
			<div class="row">
		<div class="col-lg-12 col-md-12">
			
			<div class="portlet light ">
				<div class="portlet-title">
							<div class="caption">
								<i class="icon-share font-red-sunglo"></i>
								<span class="caption-subject font-red-sunglo bold uppercase"> 添加商品</span>
							</div>
							<div class="actions">
								<a class="btn btn-circle btn-icon-only blue" href="javascript:;" onclick="alert_ts('<?php echo $this -> config -> item('xt_ts'); ?>')"> <i class=" icon-bulb"></i> </a>
								<a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;"> </a>
							</div>
						</div>
				<div class="portlet-body">
					<form role="form" method="post" id="add_sp">
							
							<div class="form-group">
								<label>库存项</label>
								<input type="hidden" class="form-control" id="color_item" name="color_item" placeholder="颜色或款式" value=""/>
								<input type="hidden" class="form-control" id="colorx" name="color" placeholder="颜色或款式" value=""/>
								<p>
								<div class="input-group" style="width: 300px;">
								<select id="color_type" class="form-control">
									<?php foreach($this->config->item('color_type') as $k=>$v){?>
									<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
									<?php } ?>
								</select>
								<span class="input-group-btn">
								      <button style="display: inline-block;" onclick="add_color_type()" type="button" class="btn btn-default">添加</button>
								</span>
								</div>
								</p>
								<hr />
								<div id="color_type_body">
									
								</div>
								
								<br />
								<table class="table table-bordered" id="color_table" style="display: none;">
									<tbody id="color_tbody">
									<tr id="color_tbody_head">
										<td width="100">价格</td>
										<td width="100">库存</td>
										<td width="100">编号</td>
									</tr>
									</tbody>
                                 </table>
							</div>
							<div class="form-group" style="display: none;">
								<div class="row">
  <div class="col-lg-6">
    <div class="input-group">
    	<input type="text" class="form-control" placeholder="请输入数字" id="ty_jg">
      <span class="input-group-btn">
        <button onclick="ty_jgx()" class="btn btn-default" type="button">统一设置价格</button>
      </span>
      
    </div><!-- /input-group -->
  </div><!-- /.col-lg-6 -->
  <div class="col-lg-6">
    <div class="input-group">
      <input type="text" class="form-control" placeholder="请输入数字" id="ty_kc()">
      <span class="input-group-btn">
        <button onclick="ty_kcx()" class="btn btn-default" type="button">统一设置库存</button>
      </span>
    </div><!-- /input-group -->
  </div><!-- /.col-lg-6 -->
</div><!-- /.row -->
							</div>
							<div class="form-group">
								<label>库存量</label>
								<input class="form-control number required" name="kc" id="set_kc" placeholder="填写数字"/>
							</div>
							
							<div class="form-group">
								<?php echo $this -> form -> doform('pic', 'pic1', '', ''); ?>
							</div>
							<div class="form-group">
								<?php echo $this -> form -> doform('pic', 'pic2', '', ''); ?>
							</div>
							<div class="form-group">
								<?php echo $this -> form -> doform('pic', 'pic3', '', ''); ?>
							</div>
							<div class="form-group">
								<label>购买按钮</label>
								<?php echo $this -> form -> doform('pic', 'gm_bt', '', ''); ?>
							</div>
							
							<div class="form-group">
								<label>提货方式</label>
								 <select  id="xffs" name="xffs" class="form-control">
								 	<option value="1"   >物流快递</option>
								 	<option value="2"  >到店消费</option>
								 </select>
							</div>
							
								<div class="form-group">
								<label>供货机构</label>
								 <select  id="staff_id" name="staff_id" class="form-control">
								 	<option value="0">请选择供货机构</option>
    	                   <?php
    	//获取提货的店铺
				$this -> db -> select('staff_id,jg_name,jg_qy');
				$this -> db -> group_by('jg_qy');
				$q = $this -> db -> get_where('staff', array('state' => 3, 'staff_del' => 1));
				$shop = $q -> result_array();
    	 foreach($shop as $v){?>
    	<optgroup label="<?php echo $v['jg_qy']; ?>">
    		<?php $this -> db -> select('staff_id,jg_name,jg_qy');  $q=$this->db->get_where('staff',array('jg_qy'=>$v['jg_qy'],'state' => 3, 'staff_del' => 1)); foreach($q->result_array() as $vv){  ?>
            <option value="<?php echo $vv['staff_id']; ?>"><?php echo $vv['jg_name']; ?></option>
         <?php } ?>
     </optgroup>
    <?php } ?>
    </select>
							</div>
							
							<div class="form-group">
								<label>是否通过红包发送供货款</label>
								<select name="sk_is" class="form-control">
									<option value="2">关闭</option>
									<option value="1">启用</option>
								</select>
							</div>
							
							<div class="form-group">
								<label>一级代理积分</label>
								<input class="form-control number" name="dl" placeholder="只填写数字" value="0"/>
							</div>
							<div class="form-group">
								<label>二级代理积分</label>
								<input class="form-control number" name="dl1" placeholder="只填写数字" value="0"/>
							</div>
							<div class="form-group">
								<label>三级代理积分</label>
								<input class="form-control number" name="dl2" placeholder="只填写数字" value="0"/>
							</div>
							<div class="form-group">
								<label>礼券金额</label>
								<input class="form-control number" name="lq" placeholder="只填写数字" value="0"/>
							</div>
							
							<div class="form-group">
								<select class="form-control" name="sj">
									<option value="1">上架</option>
									<option value="2">下架</option>
								</select>
							</div>
							
							<div class="form-group">
								<label>简介</label>
								<textarea class="form-control required" style="height: 100px;" name="jj" placeholder=""></textarea>
							</div>
							<div class="form-group">
								<textarea bs="bs" class="form-control" style="height: 300px;" name="ms" placeholder="内容"></textarea>
							</div>
							<button type="reset" class="btn default">
								<i class="fa fa-refresh"></i>
								重置
							</button>
							<button type="submit" class="btn blue">
								<i class="fa fa-send"></i>
								添加商品
							</button>
						</form>
				</div>
			</div>
		</div>

</div>
		</div>
	</div>
	<!-- BEGIN QUICK SIDEBAR -->
	<?php $this -> load -> view('adminx/lt'); ?>
	<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->

<?php $this -> load -> view('adminx/footer'); ?>
<script src="/mex/global/plugins/k/kindeditor-min.js"></script>
<script src="/mex/global/plugins/ajaxfileupload.js"></script>
<script src="/mex/lance/sgl_color.js"></script>
<script>
	var editorx;
	$(function() {
		editorx = KindEditor.create('textarea[bs="bs"]', {
			minWidth : 400,
			height : 400,
			uploadJson : "/common/kup"

		});
		up_form($("#add_sp"), "/iadmin/sp/add", "添加商品", function(msg) {
			if (msg.type == 1) {
				alert_ts('添加商品成功，3秒后回到商品列表...');
				setTimeout(function(){
					window.location.href="/iadmin/sp";
				},3000);
			} else {
				alert_ts('添加商品失败！');
			}
		});
	}); 
</script>



<?php $yx=array(1,2); if(in_array($this->session->userdata('state'), $yx)){ ?>
								<?php } ?>
